CC = gcc
LIBS = librtmp.a

#export PKG_CONFIG_PATH=$(HOME)/install/x64/ffmpeg/lib/pkgconfig

## FFmpeg version is 3.2.14
FFMPEG_ROOT=$(HOME)/install/x64/ffmpeg

FFMPEG_INCS=$(shell export PKG_CONFIG_PATH=${FFMPEG_ROOT}/lib/pkgconfig;pkg-config --cflags libavformat libavcodec libswresample libswscale libavutil)
FFMPEG_LIBS=$(shell export PKG_CONFIG_PATH=${FFMPEG_ROOT}/lib/pkgconfig;pkg-config --libs libavformat libavcodec libswresample libswscale libavutil)

#FFMPEG_INCS = -I$(FFMPEG_ROOT)/include
#FFMPEG_LIBS = -L$(FFMPEG_ROOT)/lib -lavformat -lavcodec -lswresample -lswscale -lavutil

FFMPEG_LIBS+= -Wl,-rpath=$(HOME)/install/x64/ffmpeg/lib

TARGETS = test_librtmp test_ff00 test_ffrtmp

all: $(TARGETS)

test_librtmp: test_librtmp.c
	$(CC) -o $@ $^ $(LIBS)

test_ff00: test_ffrtmp_00.c
	@echo FFMPEG INCS = $(FFMPEG_INCS)
	@echo FFMPEG LIBS = $(FFMPEG_LIBS)
	$(CC) -o $@ $^ $(FFMPEG_INCS) $(FFMPEG_LIBS)

test_ffrtmp: test_ffrtmp_01.c ffrtmp.c
	@echo FFMPEG INCS = $(FFMPEG_INCS)
	@echo FFMPEG LIBS = $(FFMPEG_LIBS)
	$(CC) -g -o $@ $^ $(FFMPEG_INCS) $(FFMPEG_LIBS)

clean:
	rm -rf *.o $(TARGETS)
